
public class AudioSection {

	public String start ;
	public String stop;
	public double [] values;
	
	public String toString()
	{
		StringBuilder sb = new StringBuilder();
		sb.append("start:");
		sb.append(start);
		sb.append(" ");
		sb.append("stop:");
		sb.append(stop);
		sb.append(" ");
		sb.append("12DimensionValues:");
		for(int i=1; i< values.length; i++)
		{
			sb.append(values[i]);
			sb.append(",");
		}
		sb.append("\r\n");
		return sb.toString();
	}
	
	public void ReadFromString(String line)
	{
		String [] keyValues = line.split(" ");
		for(int i=0; i < keyValues.length; i++)
		{
			String [] keyVal = keyValues[i].split(":");
			if(keyVal.length ==2)
			{
				String key = keyVal[0];
				String val = keyVal[1];
				if(key.contains("start"))
				{
					start = val;
				}
				else if(key.contains("stop"))
				{
					stop = val;
				}
				else if(key.contains("12DimensionValues"))
				{
					values = Extractvalues(val);
				}
			}
		}
	}
	
	private double [] Extractvalues(String text)
	{
		int dimesion = 12;
		double [] values = new double[dimesion];
		String [] textValues = text.split(",");
		for(int i=0; i < dimesion; i++)
		{
			values[i] = Double.parseDouble(textValues[i]);
		}
		return values;
	}

}
